package com.csw.springbootquartz.service;

import com.csw.springbootquartz.dao.SchedulerJobDao;
import com.csw.springbootquartz.entity.SchedulerJobEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 1
 */
@Service
public class SchedulerJobServiceImpl implements SchedulerJobService {
    @Autowired
    private SchedulerJobDao schedulerJobDao;

    @Override
    public SchedulerJobEntity findByid(String id) {
        return schedulerJobDao.selectById(id);
    }

    @Override
    public void updateCronById(String id, String cron, String running) {
        SchedulerJobEntity schedulerJobEntity = schedulerJobDao.selectById(id);
        schedulerJobEntity.setCron(cron);
        schedulerJobEntity.setRunning(running);
        schedulerJobDao.updateById(schedulerJobEntity);
    }

}
